home *** CD-ROM | disk | FTP | other *** search
/ MacTech 1 to 12 / MacTech-vol-1-12.toast / Source / MacTech® Magazine / Volume 11 - 1995 / 11.02 Feb 95 / Yenta / SendWindowƒ / CPPZoneList.cp < prev    next >
Encoding:
Text File  |  1996-04-04  |  2.9 KB  |  116 lines  |  [TEXT/KAHL]

  1. /********************************************************* DEFINITION
  2.     DATE:    9/28/93
  3.     AUTHOR: Eric R. Rosé
  4.     
  5.     CLASS:  CPPZoneList
  6.     
  7.     SUPERCLASS: CPPVisualStrList
  8.     
  9.         This C++ class manages a list of zone name strings
  10.     
  11. ********************************************************************/
  12.  
  13. #pragma once
  14.  
  15. #include "CPPZoneList.h"
  16. #include <CPPNodeInfo.h>
  17. #include <CPPStringList.h>
  18. #include <CPPDArray.h>
  19. #include <StringTools.h>
  20.  
  21. /*-----------------------------------------------------------------*/
  22. /*--------------------------- GLOBALS -----------------------------*/
  23. /*-----------------------------------------------------------------*/
  24.  
  25.     extern    RGBColor    RGBWhite;
  26.     extern    StringPtr            gZoneName; 
  27.  
  28. /*-----------------------------------------------------------------*/
  29. /*------------------------ PUBLIC METHODS -------------------------*/
  30. /*-----------------------------------------------------------------*/
  31.  
  32.     CPPZoneList::CPPZoneList (CPPWindow *theWindow, Rect *boundsRect,
  33.                               CPPDArray *coreData, Boolean ownsData) :
  34.                 CPPVisualStringList (theWindow, boundsRect,
  35.                                      coreData, ownsData, 
  36.                                      TRUE, lOnlyOne, 14)
  37.     {
  38.         
  39.     }
  40.     
  41. /*-----------------------------------------------------------------*/
  42.  
  43.     CPPZoneList::~CPPZoneList (void)
  44.     {
  45.     
  46.     }
  47.             
  48. /*-----------------------------------------------------------------*/
  49.  
  50.     char    *CPPZoneList::ClassName (void)
  51.     {
  52.         return "CPPZoneList";
  53.     }
  54.  
  55. /*-----------------------------------------------------------------*/
  56.  
  57.     CPPStringList    *CPPZoneList::MakeListOfZones (void)
  58.     /* copy all of the object's strings into a pure stringlist */
  59.     {
  60.         CPPStringList    *TempList = new CPPStringList();
  61.         
  62.         if (TempList && this->coreData)
  63.           {
  64.               for (long i = 1; i <= GetNumItems(); i++)
  65.                 TempList->AppendItem(String2String((*this)[i]));
  66.           }
  67.           
  68.         return TempList;
  69.     }
  70.  
  71. /*-----------------------------------------------------------------*/
  72.  
  73.     StringPtr    CPPZoneList::operator[] (long getWhich)
  74.     {
  75.         CPPStringList    *theList = (CPPStringList *)this->GetItsData();
  76.         
  77.         if (theList)
  78.           return ((*theList)[getWhich]);
  79.         else
  80.           return NULL;
  81.     }
  82.  
  83. /*-----------------------------------------------------------------*/
  84. /*---------------------- PROTECTED METHODS ------------------------*/
  85. /*-----------------------------------------------------------------*/
  86.  
  87.     void    CPPZoneList::DrawCellContents (long whichCell, Rect *itsFrame, 
  88.                                       Boolean selected)
  89.     {
  90.         long    theIndex;
  91.         StringPtr    theName = NULL;
  92.         GVarHandle    CG = (GVarHandle)((CWindowPeek)
  93.                           (this->owningWindow))->port.grafVars;
  94.         
  95.         if (this->coreData)
  96.           theName = (*this)[whichCell];
  97.         
  98.         if (this->InColorWindow() && selected)
  99.           RGBBackColor ((&(**CG).rgbHiliteColor));
  100.  
  101.         if (theName)
  102.           {
  103.               if (PStrCmp (theName, gZoneName) == 0)
  104.                 TextFace(bold);
  105.               TextBox(theName+1, *theName, itsFrame, teJustLeft);
  106.               TextFace(0);
  107.           }
  108.                               
  109.         if (selected)
  110.           if (InColorWindow())
  111.             RGBBackColor (&RGBWhite);
  112.           else
  113.             InvertRect (itsFrame);
  114.     }
  115.         
  116.